const MyPromise = require('./MyPromise_5');
function p1 () {
    return new MyPromise(function (resolve, reject) {
        setTimeout(() => {resolve('p1 success')}, 1000)
    });
}
function p2() {
    return new MyPromise((resolve, reject) => {
        reject('p2 fail')
    })
}




p2().finally(() => {
    console.log("finally");
    return p1();
}).then(v => {
    console.log(v);
}, r => {
    console.log(r);
})

// p2().finally(() => {
//     console.log("finally")
// }).then(v => {
//     console.log(v);
// }, r => {
//     console.log(r);
// })